<?php
	
if (isset($_POST['lista_prod'])){
	editarPedido($_POST);
}

?>


<br />


<style>
.td{
	border-bottom-style:none;
    border-left-style:none;
}
</style>

<script languaje="JavaScript">

function setStyle(style,item) {
item.className = style;
}


</script>

<script type="text/javascript">
function submitform()
{
    document.forms["myform"].submit();
}
</script>


 
<table>
<tr align="left">
	<td class="tdCarpeta" style="width:80px">
							<a href="index.php">
                    <img src="../../images/back.png" title="Regresar" width="60" height="45"/></a>
	</td>
</tr>
<tr>
	<td class="tdCarpeta"> <a href="index.php">Regresar </a>
	</td>
</tr>
</table>
<br />
<form id="myform" method="post" enctype="multipart/form-data" action="">

<div class="table" style="margin-left:3px;">
  <div class="tr" style="background-color:#7E97E9;">
    <div class="td" style="width:110px">ProductoID</div>
    <div class="td" style="width:200px">Nombre Producto</div>
    <div class="td" style="width:110px">Categor&iacute;a</div>
    <div class="td" style="width:150px"> Estado Actual</div>
    <div class="td" style="width:30px"></div>

  </div>
<?php
			
			
			$prods = getProductos($_GET['id']);	
			$num = count($prods);

			for($i=0;$i < $num;$i++){	
			$prod = $prods[$i];
			
						
			print("<div class='tr' onmouseover=\"setStyle('trMouseOver',this);\"onmouseout=\"setStyle('tr',this);\">");
			
			print("<div class='td' style='text-align:justify'>".$prod->get_ID()."</div>");
			print("<div class='td'>".$prod->get_nombre()."</div>");			
			print("<div class='td'>".$prod->get_categoria()."</div>");
			//print("<div class='td'>".$prod->get_fecha_envio()."</div>");
			//print("<div class='td'>".$prod->get_fecha_fin()."</div>");
			print("<div class='td'><select class='inputtext' name='".$prod->get_ID()."' onchange='javascript: submitform()'>");
				  
	
				include('conf/conexion.php');
				$res = mysql_query("SELECT EstadoID,estado FROM estado;");

				while($row= mysql_fetch_row($res)){	
					if ($prod->get_estado()!=$row[0]) echo "<option value='".$row[0]."'>".$row[1]."</option>";
					else echo '<option SELECTED value='.'"'.$row[0].'"'.'>'.$row[1].'</option>'; 
				}
				  
		
			print("</select></div>");
			print("<div class='td' style='width:30px'>");

			
			print("</div></div>");
			}
		
			

?>
</div>
<input type="hidden" value="<?php echo $_GET['id'];?>" name="lista_prod" />
</form>
<br />

<table style="width:100%;">
<tr>
<td><a href="index.php" style="margin-left:460px"><img src="../images/pri.png" title="Primero" width="20" height="20" />&nbsp; <img src="../images/prev.png" title="Anterior" width="20" height="20"/> &nbsp; <img src="../images/sig.png" title="Siguiente" width="20" height="20"/> &nbsp; <img src="../images/ult.png" title="Ultimo" width="20" height="20"/></a></td>
</tr>
</table>